package jianzhiOffer;

public class Num44 {
    public int findNthDigit(int n) {
        int dig = 1;
        long start = 1;
        long count = 9;
        while(n > count) {
            n -= count;
            start *= 10;
            dig += 1;
            count = 9 * start * dig;
        }
        long num = start + (n - 1) / dig;
        return Long.toString(num).charAt((n - 1) % dig) - '0';
    }
}
